using System;
using System.Reflection;
using System.Collections.Generic;

namespace Measurements
{
    public class VolumeUnit : MeasurementUnit
    {
        public VolumeUnit(string name, string unit, ToBaseUnitDelegate toBaseUnit, FromBaseUnitDelegate fromBaseUnit)
            : base (name, unit, unit == "m^3" ? null : Volume.CubicMeter, toBaseUnit, fromBaseUnit) { }
    }
    
    public class Volume : Measurement<Volume, VolumeUnit>
    {
        public static readonly VolumeUnit CubicMeter = new VolumeUnit("cubic meter", "m^3", m => m, m => m);
        public static readonly VolumeUnit CubicCentimeter = new VolumeUnit("cubic centimeter", "cm^3", m => m / 1e6, m => m * 1e6);
        public static readonly VolumeUnit Liter = new VolumeUnit("liter", "L", m => m / 1e3, m => m * 1e3);
        public static readonly VolumeUnit Kiloliter = new VolumeUnit("kiloliter", "kL", m => m, m => m);
        public static readonly VolumeUnit Millileter = new VolumeUnit("milliliter", "mL", m => m / 1e6, m => m * 1e6);
        
        public static readonly VolumeUnit CubicInch = new VolumeUnit("cubic inch", "cu in", m => m * 0.000016387064, m => m / 0.000016387064);
        public static readonly VolumeUnit CubicFoot = new VolumeUnit("cubic foot", "cu ft", m => m * 0.028316846592, m => m / 0.028316846592);
        public static readonly VolumeUnit CubicYard = new VolumeUnit("cubic yard", "cu yd", m => m * 0.764554857984, m => m / 0.764554857984);
        public static readonly VolumeUnit CubicMile = new VolumeUnit("cubic mile", "cu mi", m => m * 4168181825.440579584, m => m / 4168181825.440579584);
    }
}
